const db = wx.cloud.database();
// pages/me/me.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		userInfo: {},
		shouCangNum: 0
	},
	onShow() {
		const userInfo = wx.getStorageSync("userInfo")
		this.setData({
			userInfo
		})
		this.onShowShoucang();
	},

	onShareAppMessage() {
		from: 'button'
		return {
			title: 'NHT脑还同商城',
			path: '/pages/home/home.wxml',
			imageUrl: 'cloud://nht-demo-5gkzj2yo2649a73b.6e68-nht-demo-5gkzj2yo2649a73b-1305779664/swiperlist/NHTlogo1.jpg'
		}
	},

	async onShowShoucang() {
		if (this.data.userInfo) {
			const res = await db.collection("goods_detail_shoucang")
				.where({
					'goods_id': this.goods_id
				})
				.get()
				.then((res) => {
					this.setData({
						shouCangNum: res.data.length
					})
				})
		}

	},

	jumpToFeedBack() {
		const userInfo = wx.getStorageSync("userInfo");
		if (!userInfo) {
			wx.showToast({
				title: '请先登录',
				icon: 'none',
				mask: true
			})
		} else {
			wx.navigateTo({
				url: "/pages/Feedback/Feedback"
			})
		}
	},

	jumpToaboutMe() {
		wx.navigateTo({
			url: "/pages/aboutMe/aboutMe"
		})
	},
	makePhoneCall() {
		wx.makePhoneCall({
			phoneNumber: '020-84787684'

		})
	}


})
